package com.hongkzh.www.adv.service;

import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Record;

public class BaseService {
    public void doFilePath(Record r){
        if(null==r) {
            return;
        }
        String imgSrc = r.getStr("imgSrc");
        String coverImgSrc = r.getStr("coverImgSrc");
        String headImg = r.getStr("headImg");
        String rheadImg = r.getStr("rheadImg");
        String background = r.getStr("background");
        String describe = r.getStr("describe");
        if (StrKit.notBlank(imgSrc)) {
            r.set("imgSrc", PropKit.get("fileServer") + imgSrc);
        }
        if (StrKit.notBlank(coverImgSrc)) {
            r.set("coverImgSrc", PropKit.get("fileServer") + coverImgSrc);
        }
        if (StrKit.notBlank(headImg)) {
            r.set("headImg", PropKit.get("fileServer") + headImg);
        }
        if (StrKit.notBlank(rheadImg)) {
            r.set("rheadImg", PropKit.get("fileServer") + rheadImg);
        }
        if (StrKit.notBlank(background)) {
            r.set("background", PropKit.get("fileServer") + background);
        }
        if(StrKit.notBlank(describe)) {
            r.set("describe", PropKit.get("fileServer") + describe);
        }
    }
}
